package cn.com.eado.crm.app.utils;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ListUtil {

    /**
     * 去除重复元素
     * @param list
     * @return
     */
    public static <T> List<T> removeDuplicate(List<T> list) {
        Set<T> set = new HashSet<>();
        List<T> newList = new ArrayList<T>();
        for (T T:list) {
            if(set.add(T)){
                newList.add(T);
            }
        }
        return newList;
    }
}
